cc.Class({
    extends: cc.Component,

    properties: {
        localbooklist: {
            default: null,
            type: cc.Node
        }
        // foo: {
        //    default: null,      // The default value will be used only when the component attaching
        //                           to a node for the first time
        //    url: cc.Texture2D,  // optional, default is typeof default
        //    serializable: true, // optional, default is true
        //    visible: true,      // optional, default is true
        //    displayName: 'Foo', // optional
        //    readonly: false,    // optional, default is false
        // },
        // ...
    },

    // use this for initialization
    onLoad: function() {
        var self=this;
        this.node.on(cc.Node.EventType.TOUCH_START, function(event) {
            let allbooks = self.localbooklist.getComponentsInChildren('bookface');
            for (var i = allbooks.length - 1; i >= 0; i--) {
                allbooks[i].node.getChildByName('delbtn').active = false;
                let anim = allbooks[i].getComponent(cc.Animation);
                //stop之后不能复原，需要手工复原
                anim.setCurrentTime(0);
                anim.stop();
                allbooks[i].node.rotation = 0;
            }
            self.node.active = false;
        });
    },
    start: function() {
        this.node.active = false;
    }


    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});